import api from "../../utils/api_util";

const app = getApp();
Page({
    data: {
        StatusBar: app.globalData.StatusBar,
        CustomBar: app.globalData.CustomBar,
        matterlist: []
    },
    onLoad: function () {
        this.getPublicMsg();
    },
    searchIcon(e) {
        let key = e.detail.value;
        let list = this.data.matterlist;
        for (let i = 0; i < list.length; i++) {
            let a = key;
            let b = list[i].title;
            if (b.search(a) != -1) {
                list[i].isShow = true
            } else {
                list[i].isShow = false
            }
        }
        this.setData({
            matterlist: list
        })
    },
    //帮助中心数据
    getPublicMsg: function () {
        let that = this;
        api.wxRequest.apiRequest(that, api.urls.informationList, {
            method: 'GET',
            data: {
                categoryId: 3,
                position: '',
                pageNumber: 1,
                pageSize: 100,
            },
            success: function (res) {
                that.setData({
                    matterlist: res.data.rows
                })
            },
        })
    },
})